import request from '@/cfsheep/request';

/**
 * 物联网通用接口
 * @type {{getDeviceListByQuery: (function(*): Promise<HttpResponse<any>>), getRemoteVideo: (function(*): Promise<HttpResponse<any>>), getCheckPointListByQuery: (function(*): Promise<HttpResponse<any>>), controllerDeviceSwitch: (function(*): Promise<HttpResponse<any>>), getDutyLogListByQuery: (function(*): Promise<HttpResponse<any>>)}}
 */
const CfIOTUtil = {

  // 根据条件拉取硬件设备
  getDeviceListByQuery: (data) => {
    return request({
      url: '/internetOfThingsAdmin/cfDevice/getListByQuery',
      method: 'GET',
      data ,
      custom: {
        showSuccess: true,
        loadingMsg: '搜索中',
        successMsg: '搜索成功',
      },
    });
  },

  // 获取设备远程视频流地址
  getRemoteVideo: (data) => {
    return request({
      url: '/internetOfThingsAdmin/cfDevice/getRemoteVideo',
      method: 'GET',
      data ,
      custom: {
        showSuccess: true,
        loadingMsg: '搜索中',
        successMsg: '搜索成功',
      },
    });
  },

  // 控制设备开关闸，启停等
  controllerDeviceSwitch: (data) => {
    return request({
      url: '/internetOfThingsAdmin/cfDevice/controllerDeviceSwitch',
      method: 'POST',
      data ,
      custom: {
        showSuccess: true,
        loadingMsg: '操作中',
        successMsg: '操作成功',
      },
      header: {
        'Content-type': 'application/json;charset=UTF-8',
      }
    });
  },

  //拉取通道
  getCheckPointListByQuery: (data) => {
    return request({
      url: '/internetOfThingsAdmin/cfCheckPoint/getListByQuery',
      method: 'GET',
      data ,
      custom: {
        showSuccess: true,
        loadingMsg: '搜索中',
        successMsg: '搜索成功',
      },
    });
  },

  // 拉取值班记录
  getDutyLogListByQuery: (data) => {
    return request({
      url: '/internetOfThingsAdmin/cfCheckPoint/getDutyLogListByQuery',
      method: 'GET',
      data ,
      custom: {
        showSuccess: true,
        loadingMsg: '搜索中',
        successMsg: '搜索成功',
      },
    });
  },

};

export default CfIOTUtil;
